{{- $src := .Src -}}
{{- with dict "Path" .Src "Resources" .Resources | partial "function/resource.html" -}}
    {{- $src = .RelPermalink -}}
{{- end -}}

{{- $alt := .Alt | default $src -}}

{{- if .Linked -}}
    <a target="_blank" href="{{ .Src | safeURL }}" title="{{ .Title | default $alt }}" {{ with .Rel }} rel="{{ . }}"{{ end }}>
        <img loading="lazy" decoding="async"
            data-sizes="auto"
             src="{{ .Src | safeURL }}"
            alt="{{ $alt }}"{{ with .Height }} height="{{ . }}"{{ end }}{{ with .Width }} width="{{ . }}"{{ end }}
        />
    </a>
{{- else -}}
    <img loading="lazy" decoding="async"
         src="{{ .Src | safeURL }}"
         alt="{{ $alt }}"
         title="{{ .Title | default $alt }}"{{ with .Height }} height="{{ . }}"{{ end }}{{ with .Width }} width="{{ . }}"{{ end }}
    />
{{- end -}}
